package com.xbs.dao.content;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import com.xbs.dao.conn.BaseDao;
/**
 * 后台登录dao层
 * @author 余凯
 *
 */
import com.xbs.dao.conn.RowDatas;
import com.xbs.entity.EmployeeEntity;
public class AdminLoginDao extends BaseDao {
	private RowDatas<EmployeeEntity> em;
	public AdminLoginDao() {
		em = new getEmp();
	}
	/**
	 * 1.根据用户姓名获取用户信息
	 * @param name
	 * @return
	 */
	public EmployeeEntity selEmp(String name){
		String sql = "select * from tb_employee where emp_name='"+name+"'";
		return query(sql, em);
	}
	
	public class getEmp implements RowDatas<EmployeeEntity>{
		@Override
		public EmployeeEntity getRowData(ResultSet rs) throws SQLException {
			EmployeeEntity em = new EmployeeEntity();
			em.setEmpname(rs.getString("emp_name"));
			em.setEmpsex(rs.getString("emp_sex"));
			em.setEmprole(rs.getString("emp_role"));
			em.setEmptel(rs.getString("emp_tel"));
			em.setEmpstore(rs.getString("emp_store"));
			em.setPwd(rs.getString("emp_pwd"));
			return em;
		}
	}
}
